package com.yanqu.road.entity.activity.pasture;

import com.yanqu.road.entity.activity.pasture.extra.PastureExtraData;

import java.util.Objects;

/**
 * 牧场点兵格子对象
 */
public class PastureBlockData {

    /**
     * 左坐标
     */
    private int left;

    /**
     * 右坐标
     */
    private int right;

    /**
     * 纵坐标
     */
    private int y;

    /**
     * 格子积分
     */
    private int score;

    /**
     * 格子额外积分
     */
    private int extraScore;

    /**
     * 动物ID
     */
    private int animalId;

    /**
     * 格子长度
     */
    private int length;

    /**
     * 能量
     */
    private int energy;

    /**
     * 额外能量(吃其他动物的)
     */
    private int extraEnergy;


    /**
     * 是否触发过技能
     */
    private boolean useSkill;

    /**
     * 额外参数
     */
    private PastureExtraData extraData;


    /**
     * 动物朝向
     */
    private int direction;

    public PastureBlockData() {

    }

    public int getLeft() {
        return left;
    }

    public void setLeft(int left) {
        this.left = left;
    }

    public int getRight() {
        return right;
    }

    public void setRight(int right) {
        this.right = right;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getAnimalId() {
        return animalId;
    }

    public void setAnimalId(int animalId) {
        this.animalId = animalId;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getEnergy() {
        return energy;
    }

    public void setEnergy(int energy) {
        this.energy = energy;
    }

    public boolean isUseSkill() {
        return useSkill;
    }

    public void setUseSkill(boolean useSkill) {
        this.useSkill = useSkill;
    }

    public PastureExtraData getExtraData() {
        return extraData;
    }

    public void setExtraData(PastureExtraData extraData) {
        this.extraData = extraData;
    }

    public int getExtraScore() {
        return extraScore;
    }

    public void setExtraScore(int extraScore) {
        this.extraScore = extraScore;
    }

    public int getExtraEnergy() {
        return extraEnergy;
    }

    public void setExtraEnergy(int extraEnergy) {
        this.extraEnergy = extraEnergy;
    }

    public int getDirection() {
        return direction;
    }

    public void setDirection(int direction) {
        this.direction = direction;
    }

    public PastureBlockData clone() {
        PastureBlockData blockData = new PastureBlockData();
        blockData.setAnimalId(animalId);
        blockData.setY(y);
        blockData.setLeft(left);
        blockData.setRight(right);
        blockData.setScore(score);
        blockData.setLength(length);
        blockData.setEnergy(energy);
        blockData.setExtraScore(extraScore);
        blockData.setExtraEnergy(extraEnergy);
        blockData.setUseSkill(useSkill);
        blockData.setDirection(direction);
        if (extraData != null) {
            blockData.setExtraData(extraData.clone());
        }
        return blockData;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PastureBlockData blockData = (PastureBlockData) o;
        return left == blockData.left && right == blockData.right && y == blockData.y && score == blockData.score && extraScore == blockData.extraScore && animalId == blockData.animalId && length == blockData.length && energy == blockData.energy && extraEnergy == blockData.extraEnergy && useSkill == blockData.useSkill && direction == blockData.direction;
    }

    @Override
    public int hashCode() {
        return Objects.hash(left, right, y, score, extraScore, animalId, length, energy, extraEnergy, useSkill, direction);
    }
}
